<template>
	<view>
		<view @click="go(item)" v-for="(item,index) in list" :key="index" class="u-flex list boxShadow">
			<view class="u-flex-2 name">
				{{item.name}}
			</view>
			<view class="u-flex-3 u-padding-20 u-line-2">
				{{item.description}}
			</view>
			<view class="u-flex-1 u-padding-20 u-type-error u-font-34 u-font-weight">
				￥{{item.price}}
			</view>
		</view>
	</view>
</template>

<script>
	import wxpay from '@/common/wxpay.js';
	
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			this.getVip()
		},
		methods: {
			go(item) {
				this.$u.post('/user/vip', {
					id: item.id
				}).then(res => {
					const wx=new wxpay(res);
			
					wx.h5pay().then(res=>{
						  uni.switchTab({
						  	url:'/pages/index/index'
						  })
					}).catch(err=>{
						uni.navigateBack({
							
						})
					})
				
				}).catch(err => {

				})
			},
			getVip() {
				this.$u.post('/index/vip', {

				}).then(res => {
					this.list = res;
				}).catch(err => {

				})

			}
		}
	}
</script>

<style scoped>
	.list {
		width: 700rpx;
		margin: 40rpx auto;
		border-radius: 10rpx;
		height: 200rpx;

	}

	.name {
		background: linear-gradient(180deg, #3CB4FE 0%, #328DFB 100%);
		height: 200rpx;
		line-height: 200rpx;
		text-align: center;
		color: #fff;
		border-radius: 10rpx 40rpx 40rpx 10rpx;

	}
</style>
